-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make dyn*
casts into a coercion, allow dyn*
upcasting
#101832
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I added a few questions and suggestions, but feel free to accept the suggestions or not and r=me.
☔ The latest upstream changes (presumably #101858) made this pull request unmergeable. Please resolve the merge conflicts. |
aed5815
to
86ce082
Compare
86ce082
to
8c7e836
Compare
cx.const_ptrcast(meth::get_vtable(cx, source, data.principal()), vtable_ptr_ty) | ||
} | ||
_ => bug!("unsized_info: invalid unsizing {:?} -> {:?}", source, target), | ||
} | ||
} | ||
|
||
// Returns the vtable pointer type of a `dyn` or `dyn*` type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will need to be implemented in cg_clif too.
Looks good to me, thanks! @bors r+ |
…holk Make `dyn*` casts into a coercion, allow `dyn*` upcasting I know that `dyn*` is likely not going to be a feature exposed to surface Rust, but this makes it slightly more ergonomic to write tests for these types anyways. ... and this was just fun to implement anyways. 1. Make `dyn*` into a coercion instead of a cast 2. Enable `dyn*` upcasting since we basically get it for free 3. Simplify some of the cast checking code since we're using the coercion path now r? `@eholk` but feel free to reassign cc `@nikomatsakis` and `@tmandry` who might care about making `dyn*` casts into a coercion
☀️ Test successful - checks-actions |
Finished benchmarking commit (b15e2c1): comparison URL. Overall result: ❌ regressions - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Footnotes |
Implemented in cg_clif as of bjorn3/rustc_codegen_cranelift@342bac9. |
I know that
dyn*
is likely not going to be a feature exposed to surface Rust, but this makes it slightly more ergonomic to write tests for these types anyways. ... and this was just fun to implement anyways.dyn*
into a coercion instead of a castdyn*
upcasting since we basically get it for freer? @eholk but feel free to reassign
cc @nikomatsakis and @tmandry who might care about making
dyn*
casts into a coercion